package com.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;

public interface UniversalDao {

    <T> void save(T t);
    
    <T> void saveOrUpdateAll(Collection<T> entitys);
    
    <T> void update(T t);
    
    <T> void delete(T t);
    
    <T> void deleteAll(Collection<T> entitys);
    
    <T> T get(Class<T> clazz, Serializable id);
    
    <T> List<T> getAll(Class<T> clazz);
    
    <T> List<T> findByDetachedCriteria(DetachedCriteria criteria);
    
    <T> List<T> findByExample(Object exampleEntity);

    <T> List<T> findByHql(final String hql);
    
    <T> List<T> findByHql(String hql, Object... objects);
    
    List<HashMap<String, Object>> findToMap(String sql) throws Exception;
    
    <T> void clear();
    
    <T> void merge(T t);
    
    <T> void flush();
    
    <T> void evict(T t);
    
    Session rrentSession();
    
    Session currentSession1();
    
    public void release(Session session);
    
}
